<%= render :partial => 'admin/suppliers/supplier_tabs', :locals => {:current => "Taxons"} %>

<div id="selected-taxons">
  <%= render :partial => "taxon_table", :locals => {:taxons => @taxons} %>
</div>

<%= form_tag('#') do %>
  <label><%= t('search') %>:</label>
  <input id="searchtext" size="25">
<% end %>

<%= javascript_tag do %>
  function search_for_taxons(){
    jQuery.ajax({
     data: {q: jQuery("#searchtext").val() }, 
     dataType: 'script',
     success: function(request){
       jQuery('#search_hits').html(request);
     },
     type: 'post',
     url: '<%= available_admin_supplier_taxons_url(@supplier) %>'
    });
  }

  jQuery("#searchtext").keypress(function (e) {
    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
      search_for_taxons();

      return false;
    } else {
       return true;
    }
  });

  jQuery("#searchtext").delayedObserver(function() {
    search_for_taxons();
  }, 0.75);
<% end %>
<br/>
<div id="search_hits"></div>
